﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LogisticsManagementSystem.TruckTeam
{
    public partial class EditTruckTeam : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int tid = Convert.ToInt32(Request.QueryString["id"]);
                List<LogisticsModel.TruckTeam> truckTeam = LogisticsBLL.TruckTeamBLL.GetTruckTeams(tid, null);
                //string account = Request.Form["account"];
                //account= truckTeam[0].TeamName;
                 //Request.Form["account"] = truckTeam[0].TeamName;
                //Request.Form["oldpassword"] = truckTeam[0].Leader;
                //Request.Form["newpassword2"] = truckTeam[0].Remark;

                txtaccount.Value= truckTeam[0].TeamName;
                oldpassword.Value= truckTeam[0].Leader;
                Password3.Value= truckTeam[0].Remark;

            }
        }

        protected void btnEdit_Click(object sender, EventArgs e)
        {
            LogisticsModel.TruckTeam truckTeam = new LogisticsModel.TruckTeam();
            truckTeam.TeamName = txtaccount.Value;
            truckTeam.Leader = oldpassword.Value;
            truckTeam.Remark = Password3.Value;
            truckTeam.TeamID= Convert.ToInt32(Request.QueryString["id"]);
            LogisticsBLL.TruckTeamBLL.EditTruckTeam(truckTeam);
        }
    }
}